<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="cmcc.operator.*" %>
<%@include file="../checkLoginSession.jsp" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
	String operator_id = request.getParameter("operator_id");
	String operator_name = request.getParameter("operator_name");
	String operator_pwd1 = request.getParameter("operator_pwd1");
	String operator_pwd2 = request.getParameter("operator_pwd2");
	String is_admin = request.getParameter("is_admin");
	System.out.println("checkAdd.jsp-----------------");
		System.out.println("\t id=" + operator_id);
		System.out.println("\t pwd=" + operator_pwd1);
		System.out.println("\t pwd=" + operator_pwd2);
		System.out.println("\t name=" + operator_name);
		System.out.println("\t is_admin=" + is_admin);
	System.out.print("----------------------------");
	if (operator_pwd1 != null && operator_pwd2 != null
			&& operator_id != null && operator_name != null
			&& is_admin != null&&operator_pwd1.equals(operator_pwd2)&&operator_id.length()>=4) {
		
		if(Operator.addOperator(operator_id, operator_name, operator_pwd1, is_admin)){
			%>
				<br/><br/><br/><br/>
				<h2 align="center">
					<font color="red">添加成功</font>
				</h2>
				<br/><br/>
				<h3 align="center">
					<a href="addOperator.jsp">继续添加</a>					
				</h3>
			<%	
		}else{
			%>
				<br/><br/><br/><br/>
				<h2 align="center">
					<font color="red">信息填写错误添加失败</font>
				</h2>
				<br/><br/>
				<h3 align="center">
					<a href="javascript:history.back()">继续添加</a>
					
				</h3>
			<%	
		}
		 
	}else{
		%>
			<br/><br/><br/><br/>
			<h2 align="center">
				<font color="red">信息填写错误</font>
			</h2>
			<br/><br/>
			<h3 align="center">
				<a href="javascript:history.back()">返回</a>
			</h3>
		<%
		
	}
%>
